package com.other.thread;

public class ThreadDemo {

	public static void main(String[] args) {
		Thread t = new Thread(new Actor1());
		Thread t2 = new Thread(new Actor2());
		System.out.println("开始*********");
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
		t.start();
		try {
			t.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		t2.start();
		
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
		System.out.println("结束*********");
	}
}

class Actor1 implements Runnable{

	@Override
	public void run() {
		for (int i = 0; i < 5; i++) {
			System.out.println(Thread.currentThread().getName()+"_"+i);
		}
	}
	
}
class Actor2 implements Runnable{
	
	@Override
	public void run() {
		for (int i = 0; i < 5; i++) {
			System.out.println(Thread.currentThread().getName()+"_"+i);
		}
	}
	
}
